<?/*
Dette view kalder:
view->core/tid (til tidsvalget)
controller->indhold (til at oprette beskrivelsen)	
*/?>




<?
$deltager = $this->session->userdata('deltager');
$ingame = $this->session->userdata('ingame');
	//echo "<br>(view>core/opret_beskrivelse) ingame er "; print_r($ingame);
$type = $this->uri->segment(4,0);
$feature = $this->uri->segment(7,0);
$id_element = $this->uri->segment(5,0);
?>
<form action="<?php echo base_url();?>indhold/opret" method="post">
<input type="hidden" name="id_element" value="<? echo $id_element; ?>">
<input type="hidden" name="type" value="<? echo $type; ?>">
<?
if($feature == "0")
{	
	?><select name='feature'><?

	$classes = $this->struktur_model->find_classes($stamdata['id']);
	$features = $this->beskrivelse->features($classes);
	foreach($features as $r)
	{
		echo "<option value='".$r['feature']."'>".$r['feature_navn']."</option>";
	}
	?></select><?
}
else //sendes feature med som en hidden
{
	$feature_array = $this->beskrivelse->feature($feature);
	$feature_array['feature_tekst'] = str_replace("&element;", $navne[0], $feature_array['feature_tekst']);
	
	if($type == "individ")
	{
		$pps = $this->ord_model->pps($stamdata['id']);
		$feature_array['feature_tekst'] = str_replace("&pps;", $pps, $feature_array['feature_tekst']);
		
	}


	?><input type="hidden" name="feature" value="<? echo $feature;?>"><?
}



?>
<p class='rubrik' style=";float:right;text-align:right;">
<?
if(!empty($ingame) and $ingame['ingame_id'] != 0 and $ingame['ingame_id'] != -1)
{
	?>	
	<input type="hidden" name="forfatter" value="<? echo $ingame['ingame_id'];?> ">
<!-- SKRIVER ---------------------------------------------------------------------------------------->
	
	<span onclick="showstuff('vaelg_type_game')">
	<b>Skriver</b></span>:
	<input type="radio" name="type_game" value="in_game" checked="checked" onclick="hidestuff('fravaelg_tid')" ><? echo $ingame['ingame_navn']."<b></b>"; ?>
	
	
	<span id="vaelg_type_game" style="display:none">
		<? echo nbs(14); ?>
		<input onclick="showstuff('fravaelg_tid')" type="radio" name="type_game" value="off_game"><?echo $deltager['fornavn'];?><br>
	</span>
	

	<?

}elseif($ingame['ingame_id'] == 0){ //hvis man er gamemaster
	echo "<span class='rubrik'><b>Skriver</b>: Gamemaster ".$deltager['fornavn']."</span>";
	?><input type="hidden" name="type_game" value="off_game"><?
}elseif($ingame['ingame_id'] == -1){ //hvis man er side-administrator
	echo "<span class='rubrik'><b>Skriver</b>: ".$deltager['fornavn']."</span>";
	?><input type="hidden" name="type_game" value="off_game"><?
}else{
	echo "<span class='rubrik'><b>Skriver</b>: ".$deltager['username']."</span>";
	?><input type="hidden" name="type_game" value="off_game"><?

}
?>

</p>
<?
echo "<h1 class='rubrik'>".$feature_array['feature_navn']."</h1>";

echo "<p class='rubrik'>".$feature_array['feature_tekst']."</p>";


?>






<br>
<p class="rubrik"><b>Resume:</b></p><input name="overskrift" type="text" style="width:98%;height:20px;">
<br><br>
<p class="rubrik"><b>Uddybning:</b></p>
<div class="ink"><textarea id="editable" name="tekst" cols="50" style="width:98%;height:200px;"></textarea></div>
<br><br>

<?
$data['datoarray'] = $ingame_nu['tid_dato'];
?>
<p class="rubrik" style="float:right;"><b>Tid:</b><br>
<?
$this->load->view('core/tid', $data);
?><br>
</p>


<p class="rubrik"><input type="radio" name="hemmelig" value="3" checked="checked">Hemmelig</input><br><input type="radio" name="hemmelig" value="1">Offentlig</input></p><br>

<span id="fravaelg_tid" class="rubrik"  <?if(!empty($ingame)){ echo 'style="display:none"'; }?>> <input type="checkbox" name="fravaelg_tid" value="ja"> Fravælg tid </span>
<br>
<input type="submit" value="Tilføj Detalje" class="rubrik" style="float:right;border:2px solid #8C0A00;">
</form>

              <script type="text/javascript">
                     Aloha.ready( function() {
                            var $ = Aloha.jQuery;
                            $('#editable').aloha();
                     });
              </script>


